//
//  YCMessage2TableViewCell.m
//  lianganyuchu
//
//  Created by iMac on 17/2/24.
//  Copyright © 2017年 杭州桑缇电子商务有限公司. All rights reserved.
//

#import "YCMessage2TableViewCell.h"

@implementation YCMessage2TableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.backView addShadowWith:CGSizeMake(kMainScreen_Width-2*kDistance, 240)];
    
    self.iconView.layer.cornerRadius=35/2;
    self.iconView.layer.masksToBounds=YES;
    
    [self.label1 setFont:[UIFont LightFontOfSize:14]];
    [self.label1 setTextColor:TEXT_LIGHT];
    [self.label2 setFont:[UIFont LightFontOfSize:16]];
    [self.label2 setTextColor:TEXT_DEEP];
    [self.label3 setFont:[UIFont LightFontOfSize:16]];
    [self.label3 setTextColor:TEXT_DEEP];
    [self.label4 setFont:[UIFont LightFontOfSize:16]];
    [self.label4 setTextColor:TEXT_DEEP];
    [self.label5 setFont:[UIFont LightFontOfSize:16]];
    [self.label5 setTextColor:TEXT_DEEP];
    [self.label6 setFont:[UIFont LightFontOfSize:15]];
    [self.label6 setTextColor:TEXT_MIDDLE];
    [self.label7 setFont:[UIFont LightFontOfSize:15]];
    [self.label7 setTextColor:TEXT_MIDDLE];
    
    [self.labTime setFont:[UIFont LightFontOfSize:15]];
    [self.labTime setTextColor:TEXT_MIDDLE];
    [self.labPhone setFont:[UIFont LightFontOfSize:15]];
    [self.labPhone setTextColor:BLUE_COLOR];
    [self.labPhone click:self action:@selector(phoneClicked:)];
    
    [self.distanceField setBackgroundColor:WHITE_COLOR];
    [self.distanceField setTextColor:getUIColor(0xFF3F61)];
    [self.distanceField setFont:[UIFont LightFontOfSize:15]];
    self.distanceField.layer.cornerRadius=2.0f;
    self.distanceField.layer.borderColor=LINE_COLOR.CGColor;
    self.distanceField.layer.borderWidth=1.0f;
    self.distanceField.enabled=NO;
    
    UIView *rightView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 25, 30)];
    UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 11, 14, 8)];
    [imageView setImage:[UIImage imageNamed:@"shop_down"]];
    [rightView addSubview:imageView];
    self.distanceField.rightView=rightView;
    self.distanceField.rightViewMode=UITextFieldViewModeAlways;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)bindWith:(ShopTable *)shop
{
    [self.iconView load:shop.logo];
    [self.labPhone setText:shop.tel];
    [self.labTime setText:shop.business_time];
    [self.distanceField setText:[NSString stringWithFormat:@"%.1f",shop.scope.floatValue/1000]];
    
}
-(void)phoneClicked:(id)sender
{
    [self callPhoneWith:self.labPhone.text];
}


@end
